//
//  LanguageTool.m
//  differentThoughts
//
//  Created by 如沐春风 on 2021/8/23.
//

#import "LanguageTool.h"

@implementation LanguageTool
+ (NSString *)DPLocalizedString:(NSString *)translation_key {
    NSString * s = NSLocalizedString(translation_key, nil);
    NSString *CURR_LANG = [[NSLocale preferredLanguages] objectAtIndex:0];
    if (![CURR_LANG containsString:@"en-"] && ![CURR_LANG containsString:@"zh-"] && ![CURR_LANG containsString:@"es-"]) {
        NSString * path = [[NSBundle mainBundle] pathForResource:@"en"ofType:@"lproj"];
        NSBundle * languageBundle = [NSBundle bundleWithPath:path];
        s = [languageBundle  localizedStringForKey:translation_key value:@""table:nil];
    }
    return s;
}
@end
